package com.burstly.lib.component.networkcomponent.burstly.html.ormma;

import android.content.Context;
import android.util.Log;
import android.webkit.JavascriptInterface;
import com.burstly.lib.component.networkcomponent.burstly.html.ormma.listener.AccelListener;

public class OrmmaSensorController extends OrmmaController
{
  private static final String LOG_TAG = "OrmmaSensorController";
  private AccelListener mAccel = new AccelListener(paramContext, this);
  private float mLastX = 0.0F;
  private float mLastY = 0.0F;
  private float mLastZ = 0.0F;

  public OrmmaSensorController(OrmmaView paramOrmmaView, Context paramContext)
  {
    super(paramOrmmaView, paramContext);
  }

  @JavascriptInterface
  public float getHeading()
  {
    Log.d("OrmmaSensorController", "getHeading: " + this.mAccel.getHeading());
    return this.mAccel.getHeading();
  }

  @JavascriptInterface
  public String getTilt()
  {
    String str = "{ x : \"" + this.mLastX + "\", y : \"" + this.mLastY + "\", z : \"" + this.mLastZ + "\"}";
    Log.d("OrmmaSensorController", "getTilt: " + str);
    return str;
  }

  public void onHeadingChange(float paramFloat)
  {
    String str = "window.ormmaview.fireChangeEvent({ heading: " + (int)(57.295779513082323D * paramFloat) + "});";
    Log.d("OrmmaSensorController", str);
    this.mOrmmaView.injectJavaScript(str);
  }

  public void onShake()
  {
    this.mOrmmaView.injectJavaScript("Ormma.gotShake()");
  }

  public void onTilt(float paramFloat1, float paramFloat2, float paramFloat3)
  {
    this.mLastX = paramFloat1;
    this.mLastY = paramFloat2;
    this.mLastZ = paramFloat3;
    String str = "window.ormmaview.fireChangeEvent({ tilt: " + getTilt() + "})";
    Log.d("OrmmaSensorController", str);
    this.mOrmmaView.injectJavaScript(str);
  }

  public void startHeadingListener()
  {
    this.mAccel.startTrackingHeading();
  }

  public void startShakeListener()
  {
    this.mAccel.startTrackingShake();
  }

  public void startTiltListener()
  {
    this.mAccel.startTrackingTilt();
  }

  void stop()
  {
  }

  public void stopAllListeners()
  {
    this.mAccel.stopAllListeners();
  }

  public void stopHeadingListener()
  {
    this.mAccel.stopTrackingHeading();
  }

  public void stopShakeListener()
  {
    this.mAccel.stopTrackingShake();
  }

  public void stopTiltListener()
  {
    this.mAccel.stopTrackingTilt();
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.html.ormma.OrmmaSensorController
 * JD-Core Version:    0.6.2
 */